Getting started with API controller
API creation and management
Abstract
Preface Copy linkLink copied to clipboard!
Providing feedback on Red Hat documentation
Red Hat appreciates your feedback on product documentation.
To propose improvements, open a Jira issue and describe your suggested changes. Provide as much detail as possible to help the documentation team to address your request quickly.
Prerequisite
- You have a Red Hat Customer Portal account. This account enables you to log in to the Red Hat Jira Software instance. If you do not have an account, you will be prompted to create one.
Procedure
- Click the following link: Create issue.
- In the Summary text box, enter a brief description of the issue.
In the Description text box, provide the following information:
- The URL of the page where you found the issue.
- A detailed description of the issue. You can leave the information in any other fields at their default values.
- In the Reporter field, enter your Jira username.
- Click Create to submit the Jira issue to the documentation team.
Thank you for taking the time to provide feedback.
Chapter 1. What is API controller? Copy linkLink copied to clipboard!
API controller enables you to manage the lifecycle of schemas and API definitions. You can design artifacts using Apicurio Studio and manage those artifacts using Apicurio Registry.
This release is a Developer Preview of API controller.
Developer Preview features are not supported by Red Hat in any way and are not functionally complete or production-ready. Do not use Developer Preview features for production or business-critical workloads. Developer Preview features provide early access to functionality in advance of possible inclusion in a Red Hat product offering. Customers can use these features to test functionality and provide feedback during the development process.
Developer Preview features might not have any documentation, are subject to change or removal at any time, and have received limited testing. Red Hat might provide ways to submit feedback on Developer Preview features without an associated SLA. For more information, see Red Hat Developer Preview - Scope of Support.
1.1. Integration of API controller with Connectivity Link Copy linkLink copied to clipboard!
After you have created an API or schema with API controller, you can use that artifact with Connectivity Link to:
- Secure your applications with TLSPolicy
- Protect your applications with AuthPolicy
- Protect your applications with RateLimitPolicy
- Connect your applications with DNSPolicy
Connectivity Link also provides observability using Grafana, Prometheus, and Alertmanager.
Additional information
1.2. Integration of Apicurio Studio with Apicurio Registry Copy linkLink copied to clipboard!
Apicurio Studio provides a UI to collaborate on draft artifacts as you design APIs and schemas. After you finalize a design, you can further manage that artifact in Apicurio Registry.
Additional information
Chapter 2. Installing API controller Copy linkLink copied to clipboard!
To install API controller use the community Operator.
Prerequisites
-
cluster-adminaccess to an OpenShift cluster.
Procedure
-
In the OpenShift Container Platform web console, log in with
cluster-adminprivileges. - In the left navigation menu, click Operators > OperatorHub.
-
In the Filter by keyword text box, enter
Apicurioto find the Apicurio API Controller. - Read the information about the Operator, and click Install to display the Operator subscription page.
Accept the default subscription settings noting the following:
- Installation mode: All namespaces on the cluster (default).
- Installed namespace: Select the namespace where you want to install the Operator, for example, api-controller. If the namespace does not already exist, click this field and select Create Project to create the namespace.
- Approval Strategy: Select Automatic or Manual.
- Click Install, and wait a few moments until the Operator is installed and ready for use.
-
Verify that the Operator is installed. After you have installed the Operator, click Operators > Installed Operators to verify that the Apicurio API Controller is installed in your selected namespace, for example
api-controller. - Change to the Developer view in the OpenShift Container Platform web console to apply the YAML required for installation.
Create a PostgreSQL database using the following YAML in the
api-controllernamespace:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a CR named
apicurio, and the required Routes using the following YAML in theapi-controllernamespace:NoteReplace
mycluster.example.comwith your cluster hostname.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Navigate to the api-controller-studio-ui Route and click the Location URL. The Apicurio Studio console should be displayed.
Chapter 3. Getting started with Apicurio Studio Copy linkLink copied to clipboard!
3.1. What is Apicurio Studio? Copy linkLink copied to clipboard!
Apicurio Studio enables you to design schemas and API definitions. It provides a web console to make it easy for API owners and developers to manage the content of event schemas and API definitions.
You can use Apicurio Studio to create a schema or API design from a simple template, use one of the detailed templates provided, or import an existing design to edit it. As you evolve your design, it is saved automatically to Apicurio Registry as DRAFT. When you are happy with your content, you can promote your design to ENABLED in Apicurio Registry.
Apicurio Studio is based on the Apicurio Studio open source community project.
Key concepts
To understand how Apicurio Studio works, it is important to understand the following key concepts:
- Apicurio Studio web console
The web environment where developers create, manage, and organize their API and schema designs.
You can use the Apicurio Studio web console to complete the following tasks:
- Browse and search the schema and API designs that are stored in Apicurio Studio
- Add new schema and API designs and versions
- Import content from a file, from a URL, or from a Apicurio Registry instance
- Show the changes that you have made in your current editing session
- Draft
An API design or schema design. When downloaded to a local project, or used in Apicurio Registry, designs are referred to as artifacts.
Apicurio Studio supports the following API types:
- AsyncAPI
- OpenAPI
Apicurio Studio supports the following schema types:
- Apache Avro
- JSON Schema
- Google Protocol Buffers (Protobuf)
Apicurio Studio use cases
The main use cases for Apicurio Studio are as follows:
Contract-first application development
You can use Apicurio Studio to visually design the API and data models (contracts) required by your applications, before you write any application code. After you define the contract, it is easier to create the application logic needed to satisfy the contract. You can generate Quarkus-based client and server applications from designs created in Apicurio Studio.
Population of Apicurio Registry
All API and schema designs are saved to Apicurio Registry. You can use Apicurio Registry features, for example:
- Creating rules for design change validation.
- Using the Apicurio Registry REST API to dereference complex JSON Schemas.
3.2. Creating an API draft Copy linkLink copied to clipboard!
Use the Apicurio Studio web console to create an OpenAPI or AsyncAPI definition.
Prerequisites
- You’re logged in to the Apicurio Studio web console.
Procedure
- In the Apicurio Studio web console, click Create draft.
Complete the wizard to provide the following details for the new draft:
Specify the Draft Coordinates and click Next:
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
defaultDraft group. Alternatively, you can enter an optional Group ID or Draft ID. - Version number: Optionally specify a version number.
- Type: Use the default Auto-Detect setting to automatically detect the Draft type (not allowed if creating an empty Draft), or select the Draft type from the list, for example, OpenAPI.
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
Specify the Draft Content and click Next:
From template: Choose from the list of templates.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
my-openapi.jsonormy-schema.proto. Alternatively, you can enter the file contents in the text box. -
From URL: Enter a valid and accessible URL, and click Fetch. For example:
https://petstore3.swagger.io/api/v3/openapi.json.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
Specify the Draft Metadata:
- Name: Enter an optional friendly name for the first artifact version.
- Description: Enter an optional description for the first artifact version.
- Click Create to create the draft. The Draft details view is displayed.
To edit the draft, click Edit draft.
Click the Design tab, and optionally edit the draft as follows:
- Provide a version number and a description.
- (AsyncAPI only) Define terms of service.
- Add your contact information: name, email address, and URL.
- Select a license.
- (OpenAPI only) Define tags.
- Define one or more servers.
- Configure a security scheme.
- (OpenAPI only) Specify security requirements.
- (OpenAPI only) Configure vendor extensions.
- Click the Source tab, and review the live preview of the draft. The content of the Source tab automatically updates when you edit values on the editor page.
- (Optional) To see the changes that you made since the last save, click Actions > Show draft changes.
(Optional) In the left pane of the draft editor, you can add the following items:
- (OpenAPI only) Resource paths, data types, and responses
- (AsyncAPI only) Channels, data types, messages, operation traits, and message traits
- Click Save.
- Use the breadcrumbs to navigate back to the Drafts page.
The new draft is listed on the Drafts page using the Group ID and Draft ID. You can use the options icon (three vertical dots) to view the draft details, edit the draft content, finalize the draft, view the draft in Apicurio Registry, or delete the draft.
Additional information
3.3. Creating a schema draft Copy linkLink copied to clipboard!
Use the Apicurio Studio web console to create an Apache Avro, JSON Schema, or Google Protocol Buffers (Protobuf) event schema.
Prerequisites
- You’re logged in to the Apicurio Studio web console.
Procedure
- In the Apicurio Studio web console, click Create draft.
Complete the wizard to provide the following details for the new draft:
Specify the Draft Coordinates and click Next:
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
defaultDraft group. Alternatively, you can enter an optional Group ID or Draft ID. - Version number: Optionally specify a version number.
- Type: Use the default Auto-Detect setting to automatically detect the Draft type (not allowed if creating an empty Draft), or select the Draft type from the list, for example, Apache Avro.
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
Specify the Draft Content and click Next:
From template: Choose from the list of templates.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
my-openapi.jsonormy-schema.proto. Alternatively, you can enter the file contents in the text box. -
From URL: Enter a valid and accessible URL, and click Fetch. For example:
https://petstore3.swagger.io/api/v3/openapi.json.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
Specify the Draft Metadata:
- Name: Enter an optional friendly name for the first artifact version.
- Description: Enter an optional description for the first artifact version.
- Click Create to create the draft. The Draft details view is displayed.
To edit the draft, click Edit draft.
- Click the Design tab, and edit the draft.
- (Optional) To see the changes that you made since the last save, click Actions > Show draft changes.
- (Optional) In the left pane of the draft editor, you can add the following items:
- Click Save.
- Use the breadcrumbs to navigate back to the Drafts page.
The new draft is listed on the Drafts page using the Group ID and Draft ID. You can use the options icon (three vertical dots) to view the draft details, edit the draft content, finalize the draft, view the draft in Apicurio Registry, or delete the draft.
Additional information
3.4. Finalizing a draft Copy linkLink copied to clipboard!
Use the Apicurio Studio web console to finalize a draft. This action changes the status of the artifact in Apicurio Registry from DRAFT to ENABLED.
Prerequisites
- You’re logged in to the Apicurio Studio web console.
Procedure
Navigate to the draft in Apicurio Studio. For example:
- Set Filter by to Name
- Enter the name of the draft in the search field.
- Click the Search icon or press Return.
You can finalize a draft in two ways:
- From the search results, click the options icon (three vertical dots) and choose Finalize draft.
- Click on the draft coordinates listed in the search results to see the draft details page and then click the Finalize draft button.
The Final draft? modal is displayed.
Confirm that you want to finalize the draft.
A Dry run only option allows you to validate the draft before finalizing it.
A confirmation page appears with the details of the artifact.
ImportantAfter a draft is finalized, you can no longer view or edit that artifact in Apicurio Studio. You must use Apicurio Registry to perform further edits.
- Navigate to the artifact in Apicurio Registry. From the confirmation page, you can navigate to the artifact in Apicurio Registry by selecting View in Registry from the options menu (three vertical dots).
Chapter 4. Getting started with Apicurio Registry Copy linkLink copied to clipboard!
Apicurio Registry is a powerful tool for managing and storing data schemas, API designs, or any structured content in a centralized repository. It supports a wide variety of artifact types, including Avro, Protobuf, JSON Schema, and OpenAPI definitions.
Additional information
4.1. Exploring artifacts Copy linkLink copied to clipboard!
Artifacts are the building blocks of Apicurio Registry. They represent data structures, API designs, or schema definitions stored in the registry for reuse and collaboration. You can upload, update, and retrieve artifacts, view their version history, and manage their lifecycle.
4.2. Managing groups Copy linkLink copied to clipboard!
Groups allow you to organize artifacts logically, making it easier to manage and retrieve them. Each artifact belongs to a group, and groups can represent domains, projects, or teams. Grouping provides isolation while enabling fine-grained control over access and usage policies.
4.3. Managing rules Copy linkLink copied to clipboard!
Rules in Apicurio Registry help enforce consistency and quality by validating artifacts against defined standards. You can apply global rules for the entire registry or configure specific rules for individual groups and artifacts.
4.4. Configuring settings Copy linkLink copied to clipboard!
The configuration options in Apicurio Registry allow you to tailor the registry to your specific needs. Adjust operational parameters, integrate with external systems, or configure advanced settings to enhance performance and security.
4.5. Using the API Copy linkLink copied to clipboard!
Apicurio Registry provides a robust REST API to interact with the registry programmatically. Developers can automate artifact management, integrate registry features into CI/CD pipelines, or build custom tools to enhance schema governance.
Appendix A. Using your Red Hat subscription Copy linkLink copied to clipboard!
Red Hat Connectivity Link is provided through a software subscription. To manage your subscriptions, access your account at the Red Hat Customer Portal.
Managing your subscriptions
- Go to access.redhat.com.
- If you do not already have an account, create one.
- Log in to your account.
- In the menu bar, click Subscriptions to view and manage your subscriptions.
Revised on 2024-12-09 19:07:14 UTC